function read_gould_met1m(yd)
% read_gould_met1m(yd) converts and separates 
% 1-min raw LMG JGOFS met data for yearday yd
% into MatLab variables. cleans sst and stores
% new version as sstn.  renames par to sopar. 
% used to get and clean raw data for single yd
% and save in jgyd.mat format.
% 4/11/01

% get JGOFS data
if yd<100
   filnam=['jg0',int2str(yd),'.dat'];
   eval(['load Q:\geopdata\JGOF\',filnam]);
   filnam=['jg0',int2str(yd)];
   eval(['zz=',filnam,';'])
end
if yd>=100
   filnam=['jg',int2str(yd),'.dat'];
   eval(['load Q:\geopdata\JGOF\',filnam]);
   filnam=['jg',int2str(yd)];
   eval(['zz=',filnam,';'])
end

% make time base, separate variables
dt=1/1440;
t=[yd:dt:yd+1-dt]';
x=zz(:,4);
y=zz(:,3);
z=zz(:,13);
sog=zz(:,5);
gyro=zz(:,7);
ws=zz(:,14); % wind speed
wd=zz(:,15); % wind direction
at=zz(:,16);
rh=zz(:,17);
bp=zz(:,18);
sopar=zz(:,9);
sst=zz(:,10);
sss=zz(:,12);
sw=zz(:,21);
lw=zz(:,22);

% clean sst and display 
lim=-.01;
sstn=clean_gould_sst(sst,lim);
clf
plot(t,sst,t,sstn,'r');
pause

% save 
eval(['save ',filnam,' t x y z sog gyro ws wd at rh bp sopar sst sstn sss sw lw'])

